package com.issac.demo.pooled2.commonpool;

import com.issac.demo.pooled2.mypool.ShareBike;
import org.apache.commons.pool2.PooledObject;
import org.apache.commons.pool2.PooledObjectFactory;
import org.apache.commons.pool2.impl.DefaultPooledObject;

/**
 * @author: ywy
 * @date: 2023-06-28
 * @desc:
 */
public class ShareBikeFactory implements PooledObjectFactory<ShareBike> {
    @Override
    public PooledObject<ShareBike> makeObject() throws Exception {
        return new DefaultPooledObject<>(ShareBike.init());
    }

    @Override
    public void destroyObject(PooledObject<ShareBike> p) throws Exception {

    }

    @Override
    public boolean validateObject(PooledObject<ShareBike> p) {
        return true;
    }

    @Override
    public void activateObject(PooledObject<ShareBike> p) throws Exception {

    }

    @Override
    public void passivateObject(PooledObject<ShareBike> p) throws Exception {

    }
}
